import { defHttp } from '/@/utils/http/axios'
import { TenantModel } from './model/tenantModel'
import { BasicPageParams } from '/@/api/model/baseModel'
import { BasicFetchResult } from '/@/api/model/baseModel'

enum Api {
  list = '/tenant/list',
  page = '/tenant/page',
  create = '/tenant/create',
  edit = '/tenant/edit',
}

export const listTenant = () => {
  return defHttp.get<TenantModel[]>({ url: Api.list })
}

export const pageTenant = (data: BasicPageParams) => {
  return defHttp.post<BasicFetchResult<TenantModel>>({ url: Api.page, data })
}

export const createTenant = (data: TenantModel) => {
  return defHttp.post<Boolean>({ url: Api.create, data })
}

export const editTenant = (data: TenantModel) => {
  return defHttp.post<Boolean>({ url: Api.edit, data })
}
